﻿using CapWeb251.Models;
using DotNetFramework.CAP;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CapWeb251.Services
{
    public class Op2MysqlService : ICapSubscribe
    {
        [CapSubscribe("callbackmysql-show-execute-time")]
        public void Callback(UserEntity p)
        {
            //异常后会多次尝试
            if (string.IsNullOrEmpty(p.UserName))
                throw new Exception();
            Console.WriteLine(p.UserName);
        }


        [CapSubscribe("cap251.services.insert.user")]
        public UserEntity CheckReceivedMessage(UserEntity p)
        {
            Console.WriteLine(p.UserName);
            return p;
        }
    }
}